package weakreference.case3;

public class Tomato {

    private String name;

    public Tomato(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    protected void finalize() throws Throwable {
        super.finalize();
        System.out.println("Tomato: " + name + " finalize. ");
    }

    @Override
    public String toString() {
        return "Tomato{" +
                "name='" + name + '\'' +
                '}';
    }
}
